import React from 'react';

const components = {
    photo: function (props) {
        return props.story + 2;
    },
    video: function (props) {
        return <div>{1 + props.story}</div>
    }
};

export default function ChoosingTypeAtRuntime(props) {
    // Correct! JSX type can be a capitalized variable.
    const storyType = props.storyType ? props.storyType : 'photo';
    const SpecificStory = components[storyType];
    return <SpecificStory story={storyType} />;
}